#include "HudLayer.h"

#include "Hero.h"


HudLayer::HudLayer()
{
}

HudLayer::~HudLayer()
{

}

void HudLayer::initHudLayer(GamePlayScreen *_handler)
{
    this->handler = _handler;

    this->setContentSize(CCDirector::sharedDirector()->getWinSize());
    // life display
    CCSprite *lifeSprite = new CCSprite();
    lifeSprite->initWithFile("life.png");
    lifeSprite->setPosition(CCPointMake(lifeSprite->getContentSize().width,
                                        this->getContentSize().height - lifeSprite->getContentSize().height/2));
    this->addChild(lifeSprite);
    lifeSprite->release();

    lifeLabel = CCLabelBMFont::create(CCString::createWithFormat("%d", handler->mHero->lifeNumber)->getCString(),
                                      "font/futura-48.fnt", 1, kCCTextAlignmentCenter);
    lifeLabel->setScale(lifeSprite->getContentSize().height / lifeLabel->getContentSize().height);
    lifeLabel->setPosition(lifeSprite->getPositionX() + lifeSprite->getContentSize().width * 0.75f,
                           lifeSprite->getPositionY() - lifeSprite->getContentSize().height/8.f);
    lifeLabel->setColor(ccc3(0, 200, 230));
    this->addChild(lifeLabel);

	// point display
	float xPos = this->getContentSize().width * 3.f/4.f;
	float yPos = lifeLabel->getPositionY();

	CCSprite *pointSprite = new CCSprite();
	pointSprite->initWithFile("item_0.png");
	pointSprite->setPosition(CCPointMake(xPos, yPos));
	this->addChild(pointSprite);
	pointSprite->release();

	scoreLabel = CCLabelBMFont::create(CCString::createWithFormat("%d", handler->mHero->itemArr[IT_POINT])->getCString(),
										"font/futura-48.fnt", 1, kCCTextAlignmentCenter);
	scoreLabel->setPosition(xPos, yPos);
	scoreLabel->setColor(ccc3(0, 200, 230));
	this->addChild(scoreLabel);
}

void HudLayer::setItemLabel(unsigned char _item, unsigned int _value)
{
	
}

void HudLayer::setLifeLabel(unsigned char _life)
{

}

void HudLayer::setTimerLabel(unsigned int _time)
{

}
